<div>
	<yu-panel title="资源警示管理">
		<yu-row :gutter="24">
			<yu-col :span="5">
				<yu-xtree ref="refTree" :height="height" @node-click="nodeClickFn" :data-url="treeDataUrl" data-id="paramCode" data-label="paramName"
				 data-pid="parentId" :data-async="async" :data-params="param" data-root="0000" style="margin:10px 10px 0 0;" icon="iconPath">
				</yu-xtree>
			</yu-col>
			<yu-col :span="19">
				<yu-xform related-table-name="refTable" form-type="search" v-model="searchFormdata" ref="queryModelRef">
					<yu-xform-group :column="4">
						<yu-xform-item label="资源名称" placeholder="资源名称" ctype="select" name="resourceCode" :options="resCodeOption"></yu-xform-item>
						<yu-xform-item label="资源网址" placeholder="资源网址" ctype="input" name="resourceAddr"></yu-xform-item>
					</yu-xform-group>
				</yu-xform>
				<yu-toolBar>
					<yu-button @click="addEvent" v-show="addBtnShow" v-if="addFnButton">新增 </yu-button>
					<yu-button @click="changeEvent" v-show="changeBtnShow" v-if="updateFnButton">修改</yu-button>
					<yu-button @click="deleteEvent" v-show="deleteBtnShow" v-if="deleteFnButton">删除</yu-button>
				</yu-toolBar>
				<div ref="tableBox" style="overflow: auto;">
					<yu-xtable :height="tbHeight" ref="refTable" row-number :data-url="dataUrl" :pageable="true" selection-type="radio" @selection-change="selectEvent">
						<yu-xtable-column label="警示条件名称" prop="ruleName">
							<template slot-scope="scope" :show-overflow-tooltip="true">
								<a class="diandian" style="text-decoration:underline;color:#636CE4 " href="javascipt:void(0);" @click="viewDataFn(scope.row)">{{ scope.row.ruleName }}</a>
							</template>
						</yu-xtable-column>
						<yu-xtable-column :show-overflow-tooltip="true" label="警示分类" prop="alarmClass" :options="alarmClassOptions"></yu-xtable-column>
						<yu-xtable-column :show-overflow-tooltip="true" label="资源名称" prop="resourceCode" :options="resourceCodeOptions"></yu-xtable-column>
						<yu-xtable-column :show-overflow-tooltip="true" label="资源网址" prop="resourceAddr"></yu-xtable-column>
						<yu-xtable-column :show-overflow-tooltip="true" label="警示阈值" prop="waterLimit"></yu-xtable-column>
						<yu-xtable-column :show-overflow-tooltip="true" label="持续时间" prop="timeLimit"></yu-xtable-column>
						<yu-xtable-column :show-overflow-tooltip="true" label="状态" prop="validFlag" :options="validFlagOptions"></yu-xtable-column>
						<!--<yu-xtable-column label="备注" prop="remark"></yu-xtable-column>-->
					</yu-xtable>
				</div>
				<yu-xdialog :title="viewTitle" :visible.sync="dialogVisible" width="800px">
					<el-tabs type="border-card" v-model="activeTabName">
						<el-tab-pane label="基本信息" name="basicInfo" :disabled="true">
							<yu-xform ref="refForm" v-model="formdata" label-width="120px">
								<yu-xform-group :column="2">
									<yu-xform-item label="警示分类" ctype="input" name="alarmClass" hidden></yu-xform-item>
									<yu-xform-item label="警示条件代码" :rules="rulesCode" ctype="input" maxlength="64" name="ruleCode" :disabled="!addFlag"></yu-xform-item>
									<yu-xform-item label="报警条件名称" ctype="input" maxlength="120" colspan="12" name="ruleName" :rules="rules" colspan="14"></yu-xform-item>
									<yu-xform-item label="资源名称" ctype="select" colspan="12" name="resourceCode" :rules="rules" :options="resourceCodeOptions"
									 colspan="14" placeholder="请选择"></yu-xform-item>
									<yu-xform-item label="资源网址" ctype="select" colspan="12" name="resourceAddr" :rules="rules" colspan="14" :options="resourceAddrOptions"></yu-xform-item>
									<yu-xform-item label="警示阈值" ctype="input" maxlength="100" colspan="12" name="waterLimit" :rules="integerRulesMax" colspan="14"></yu-xform-item>
									<yu-xform-item label="持续时间(秒)" ctype="input" maxlength="100" colspan="12" name="timeLimit" :rules="integerRulesOne" colspan="14"></yu-xform-item>
									<yu-xform-item label="警示状态" ctype="select" colspan="12" name="validFlag" :rules="rules" :options="validFlagOptions" colspan="14"
									 placeholder="请选择"></yu-xform-item>
									<yu-xform-item label="备注" ctype="textarea" colspan="24" maxlength="240" name="remark" colspan="14"></yu-xform-item>
								</yu-xform-group>
							</yu-xform>
							<div class="yu-grpButton">
								<yu-button @click="cancelFn">取消</yu-button>
								<yu-button type="primary" @click="nextStepFn">下一步</yu-button>
							</div>
						</el-tab-pane>

						<el-tab-pane label="对象配置" name="configInfo" :disabled="true">
							<yu-toolBar>
	<!-- 							<el-button @click="addObjCfg">新增</el-button> -->
								<el-button @click="userChoosefn">选择用户</el-button>
								<el-button @click="checkObjDataFn">已有对象</el-button>
								<!-- <el-button @click="checkGroupDataFn">对象组</el-button> -->
								<el-button @click="deleteObjCfg">删除</el-button>
							</yu-toolBar>
							<yu-xtable selection-type="checkbox" ref="refObjTab" :pageable="false" :data="objDatas" style="width: 100%" row-number max-height="350" @cell-mouse-enter="setDisabled">

								<yu-xtable-column prop="targetName" :disabled="disfalse" ctype="input" maxlength="120" label="对象名称">
								</yu-xtable-column>
								<yu-xtable-column prop="alarmMode" ctype="select" :disabled="disfalse" :options="alarmModeDatas" @change="changeAlermMode" label="报警方式">
								</yu-xtable-column>
								<yu-xtable-column prop="targetData" ctype="input" :disabled="disfalse" maxlength="64" label="对象地址">
								</yu-xtable-column>
								<yu-xtable-column prop="templateCode" ctype="select" :options="currTemplateDatas" :formatter="filterMethodFn" label="警示模版">
								</yu-xtable-column>
								<yu-xtable-column ctype="input" prop="remark" label="备注" maxlength="240">
								</yu-xtable-column>
							</yu-xtable>
							<div class="yu-grpButton">
								<yu-button @click="lastStepFn">上一步</yu-button>
								<yu-button type="primary" v-if="!isView" @click="saveFn" :disabled="isView">保存</yu-button>
								<yu-button type="info" v-if="isView" @click="saveFn" :disabled="isView">保存</yu-button>
								<yu-button @click="cancelFn">关闭</yu-button>
							</div>
						</el-tab-pane>
					</el-tabs>
				</yu-xdialog>

				<!--已有对象选择对话框-->
				<yu-xdialog title="已有对象选择" :visible.sync="objectTabVisible" width="800px">
					<el-form-q ref="queryObjRef" :field-data="queryObjFields" :buttons="queryObjButtons"></el-form-q>
					<yu-xtable ref="refObjUsedTable" row-number :data-url="objDataUrl" selection-type="checkbox">
						<yu-xtable-column label="对象名称" prop="targetName"></yu-xtable-column>
						<yu-xtable-column label="报警方式" prop="alarmMode" data-code="USE_ALERTM_MODE"></yu-xtable-column>
						<yu-xtable-column label="对象地址" prop="targetData"></yu-xtable-column>
						<yu-xtable-column label="备注" prop="remark"></yu-xtable-column>
					</yu-xtable>
				</yu-xdialog>

				<!--用户选择对话框-->
				<yu-xdialog title="用户选择" :visible.sync="objectUserTabVisible" width="800px">
					<el-form-q ref="queryObjUserRef" :field-data="queryObjUserFields" :buttons="queryObjUserButtons"></el-form-q>
					<yu-xtable ref="refObjUserTable" row-number :data-url="objDataUserUrl" :base-params="baseParam" selection-type="checkbox">
						<yu-xtable-column label="登录代码" prop="loginCode"></yu-xtable-column>
						<yu-xtable-column label="员工号" prop="userCode"></yu-xtable-column>
						<yu-xtable-column label="用户名称" prop="userName"></yu-xtable-column>
						<yu-xtable-column label="所属部门" prop="dptName"></yu-xtable-column>
						<yu-xtable-column label="邮箱" prop="userEmail"></yu-xtable-column>
						<yu-xtable-column label="电话" prop="userMobilephone"></yu-xtable-column>
					</yu-xtable>
				</yu-xdialog>
				
				<yu-xdialog title="已有对象组选择" :visible.sync="groupTabVisible" width="800px">
					<el-form-q ref="queryGroupRef" :field-data="queryGroupFields" :buttons="queryGroupButtons"></el-form-q>
					<yu-xtable ref="refGroupUsedTable" row-number :data-url="groupDataUrl" selection-type="checkbox">
						<yu-xtable-column label="对象组编号" prop="groupCode"></yu-xtable-column>
						<yu-xtable-column label="对象组名称" prop="groupName"></yu-xtable-column>
						<yu-xtable-column label="备注" prop="remark"></yu-xtable-column>
					</yu-xtable>
				</yu-xdialog>
			</yu-col>
		</yu-row>
	</yu-panel>
</div>

<style type="text/css">
	.tipTag {
		margin-bottom: 20px;
	}
	.diandian{
		overflow: hidden;
		word-break: break-all;
		box-sizing: border-box;
		text-overflow: ellipsis;
	}
</style>